package com.fengye.security.rest;

import com.fengye.security.domain.User;
import com.fengye.security.security.service.UserDetailsServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author fengyexjtu@126.com
 * @date 2022年04月12日 10:02 AM
 */
@RestController
@RequestMapping("/open")
@RequiredArgsConstructor
public class PublicResource {

    private final UserDetailsServiceImpl userDetailsService;

    @GetMapping("/greeting")
    public String greeting() {
        return "public resource!";
    }

    @GetMapping("/list")
    public List<User> list() {
        return userDetailsService.list();
    }
}
